<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 * $Log$
 *
 */
set_time_limit(0);
include_once("../config.inc.php");

session_start();
include(__Language_Path."/selectlanguage_admin.php");
include(__Common_Path."/AllWeb.inc.php");

$arrPower = CheckUsePower("getallreport");
if($arrPower === false || $arrPower[1] == "")ErrMsgOutputHTML("Error", "", 1);
$arrP1 = explode("@", $arrPower[1]);
$arrP2 = explode("#", $arrP1[1]);

if(empty($_data["GameDate"]))$_data["GameDate"] = date("Y-m-d");
if(empty($_data["GameTime1"]))$_data["GameTime1"] = "00:00:00";
if(empty($_data["GameTime2"]))$_data["GameTime2"] = "24:00:00";
$arrWeb = array();
if(sizeof($arrP2) > 0){
	foreach($_arrWeb as $key => $arrV){
		if(!in_array((int)$arrV[2], $arrP2))continue;
		$arrWeb[] = $arrV[0]."@".$arrV[3];
	}
}
//$arrCon = file("http://secure.luckyball.cc/crontab/getReport.php?GameDate=".$_data["GameDate"]."&AllWeb=".join(",", $arrWeb));

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://192.168.5.21/crontab/getReport.php");
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, "GameDate=".$_data["GameDate"]."&GameTime1=".$_data["GameTime1"]."&GameTime2=".$_data["GameTime2"]."&SortType=".$_data["SortType"]."&AllWeb=".join(",", $arrWeb));
$ret = curl_exec ($ch);
curl_close ($ch);

//print "GameDate=".$_data["GameDate"]."&GameTime1=".$_data["GameTime1"]."&GameTime2=".$_data["GameTime2"]."&SortType=".$_data["SortType"]."&AllWeb=".join(",", $arrWeb);

foreach($_arrWeb as $key => $arrV){
	$ret = str_replace("{".$arrV[0]."}", $arrV[1], $ret);
}

$arrSortType = array(0 => "序號", 1 => "注單數", 2 => "總金額", 3 => "結果");
?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{Title} (List) </title>
<link rel="stylesheet" href="../css/mem_main.css" type="text/css">
<script language="JavaScript" src="/inc/admin_envirset.js"></script>
<script language="JavaScript">
<!--
strRowClassName = "clef";
//-->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
<form action="<?php print $_SERVER["PHP_SELF"];?>" name="ReportFrm">
<table width="770" border="0" cellspacing="0" cellpadding="0" class="cmti">
  <tr> 
    <td>各站投注統計: 
報表日期：<input type="text" name="GameDate" value="<?php print $_data["GameDate"];?>" size="8">&nbsp;
下注時間：<input type="text" name="GameTime1" value="<?php print $_data["GameTime1"];?>" size="8">~
<input type="text" name="GameTime2" value="<?php print $_data["GameTime2"];?>" size="8">&nbsp;
排序：
<?php
foreach($arrSortType as $intST => $strST){
	if((int)$_data["SortType"] == $intST){
		print '<input type="radio" name="SortType" value="'.$intST.'" checked>'.$strST;
	}else{
		print '<input type="radio" name="SortType" value="'.$intST.'">'.$strST;
	}
}
?>
<input type="button" value="更新" onclick="document.ReportFrm.submit()">
    </td>
  </tr>
</table>
</form>

<div class="ctabdv"> 
<?php
print $ret;
?>
</div>
</body>
</html>